package com.clt.web.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.clt.web.common.User;
import com.clt.web.common.WeChatException;
import com.clt.web.pojo.UserInfo;
import com.clt.web.service.IWxUserService;

/**
 * 用户管理接口实现类
 * 
 * @author wenjian
 *
 */
@Service
@Transactional
public class WxUserServiceImp implements IWxUserService{
	
	private final Logger log = LoggerFactory.getLogger(getClass());

	/**
	 * 获取openid
	 */
	@Override
	public List<String> getuseropenid() {
		List<String> openids=new ArrayList<String>();
		openids=User.getAll();
		return openids;
	}

	/**
	 * 获取用户信息
	 */
	@Override
	public UserInfo getUserInfo(String openid) {
		UserInfo user=new UserInfo();
		try {
			user=User.getUserInfo(openid);
		} catch (WeChatException e) {
			log.error("根据openid{} 获取用户信息异常:{}", openid, e);
		}
		return user;
	}
	
}
